home *** CD-ROM | disk | FTP | other *** search
- package javax.swing;
-
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.IllegalComponentStateException;
- import java.awt.LayoutManager;
- import javax.accessibility.Accessible;
- import javax.accessibility.AccessibleContext;
-
- public class JRootPane extends JComponent implements Accessible {
- protected JMenuBar menuBar;
- protected Container contentPane;
- protected JLayeredPane layeredPane;
- protected Component glassPane;
- protected JButton defaultButton;
- protected DefaultAction defaultPressAction;
- protected DefaultAction defaultReleaseAction;
-
- public JRootPane() {
- this.setGlassPane(this.createGlassPane());
- this.setLayeredPane(this.createLayeredPane());
- this.setContentPane(this.createContentPane());
- ((Container)this).setLayout(this.createRootLayout());
- ((JComponent)this).setDoubleBuffered(true);
- }
-
- protected void addImpl(Component var1, Object var2, int var3) {
- super.addImpl(var1, var2, var3);
- if (this.glassPane != null && this.glassPane.getParent() == this && ((Container)this).getComponent(0) != this.glassPane) {
- ((Container)this).add(this.glassPane, 0);
- }
-
- }
-
- public void addNotify() {
- SystemEventQueueUtilities.addRunnableCanvas(this);
- super.addNotify();
- ((Component)this).enableEvents(8L);
- }
-
- protected Container createContentPane() {
- JPanel var1 = new JPanel();
- ((Component)var1).setName(((Component)this).getName() + ".contentPane");
- ((Container)var1).setLayout(new 1());
- return var1;
- }
-
- protected Component createGlassPane() {
- JPanel var1 = new JPanel();
- ((Component)var1).setName(((Component)this).getName() + ".glassPane");
- ((JComponent)var1).setVisible(false);
- ((JPanel)var1).setOpaque(false);
- return var1;
- }
-
- protected JLayeredPane createLayeredPane() {
- JLayeredPane var1 = new JLayeredPane();
- ((Component)var1).setName(((Component)this).getName() + ".layeredPane");
- return var1;
- }
-
- protected LayoutManager createRootLayout() {
- return new RootLayout(this);
- }
-
- public AccessibleContext getAccessibleContext() {
- if (super.accessibleContext == null) {
- super.accessibleContext = new AccessibleJRootPane(this);
- }
-
- return super.accessibleContext;
- }
-
- public Container getContentPane() {
- return this.contentPane;
- }
-
- public JButton getDefaultButton() {
- return this.defaultButton;
- }
-
- public Component getGlassPane() {
- return this.glassPane;
- }
-
- public JMenuBar getJMenuBar() {
- return this.menuBar;
- }
-
- public JLayeredPane getLayeredPane() {
- return this.layeredPane;
- }
-
- /** @deprecated */
- public JMenuBar getMenuBar() {
- return this.menuBar;
- }
-
- public boolean isFocusCycleRoot() {
- return true;
- }
-
- public boolean isValidateRoot() {
- return true;
- }
-
- protected String paramString() {
- return super.paramString();
- }
-
- public void removeNotify() {
- SystemEventQueueUtilities.removeRunnableCanvas(this);
- super.removeNotify();
- }
-
- public void setContentPane(Container var1) {
- if (var1 == null) {
- throw new IllegalComponentStateException("contentPane cannot be set to null.");
- } else {
- if (this.contentPane != null && this.contentPane.getParent() == this.layeredPane) {
- this.layeredPane.remove(this.contentPane);
- }
-
- this.contentPane = var1;
- this.layeredPane.add(this.contentPane, JLayeredPane.FRAME_CONTENT_LAYER);
- }
- }
-
- public void setDefaultButton(JButton var1) {
- JButton var2 = this.defaultButton;
- if (var2 != var1) {
- this.defaultButton = var1;
- if (var1 != null) {
- if (this.defaultPressAction == null) {
- this.defaultPressAction = new DefaultAction(this, true);
- this.defaultReleaseAction = new DefaultAction(this, false);
- ((JComponent)this).registerKeyboardAction(this.defaultPressAction, KeyStroke.getKeyStroke(10, 0, false), 2);
- ((JComponent)this).registerKeyboardAction(this.defaultReleaseAction, KeyStroke.getKeyStroke(10, 0, true), 2);
- ((JComponent)this).registerKeyboardAction(this.defaultPressAction, KeyStroke.getKeyStroke(10, 2, false), 2);
- ((JComponent)this).registerKeyboardAction(this.defaultReleaseAction, KeyStroke.getKeyStroke(10, 2, true), 2);
- }
-
- this.defaultPressAction.setOwner(var1);
- this.defaultReleaseAction.setOwner(var1);
- } else {
- ((JComponent)this).unregisterKeyboardAction(KeyStroke.getKeyStroke(10, 0, false));
- ((JComponent)this).unregisterKeyboardAction(KeyStroke.getKeyStroke(10, 0, true));
- ((JComponent)this).unregisterKeyboardAction(KeyStroke.getKeyStroke(10, 2, false));
- ((JComponent)this).unregisterKeyboardAction(KeyStroke.getKeyStroke(10, 2, true));
- this.defaultPressAction = null;
- this.defaultReleaseAction = null;
- }
-
- if (var2 != null) {
- ((Component)var2).repaint();
- }
-
- if (var1 != null) {
- ((Component)var1).repaint();
- }
- }
-
- ((JComponent)this).firePropertyChange("defaultButton", var2, var1);
- }
-
- public void setGlassPane(Component var1) {
- if (var1 == null) {
- throw new NullPointerException("glassPane cannot be set to null.");
- } else {
- boolean var2 = false;
- if (this.glassPane != null && this.glassPane.getParent() == this) {
- ((Container)this).remove(this.glassPane);
- var2 = this.glassPane.isVisible();
- }
-
- var1.setVisible(var2);
- this.glassPane = var1;
- ((Container)this).add(this.glassPane, 0);
- if (var2) {
- ((Component)this).repaint();
- }
-
- }
- }
-
- public void setJMenuBar(JMenuBar var1) {
- if (this.menuBar != null && this.menuBar.getParent() == this.layeredPane) {
- this.layeredPane.remove(this.menuBar);
- }
-
- this.menuBar = var1;
- if (this.menuBar != null) {
- this.layeredPane.add(this.menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
- }
-
- }
-
- public void setLayeredPane(JLayeredPane var1) {
- if (var1 == null) {
- throw new IllegalComponentStateException("layeredPane cannot be set to null.");
- } else {
- if (this.layeredPane != null && this.layeredPane.getParent() == this) {
- ((Container)this).remove(this.layeredPane);
- }
-
- this.layeredPane = var1;
- ((Container)this).add(this.layeredPane, -1);
- }
- }
-
- /** @deprecated */
- public void setMenuBar(JMenuBar var1) {
- if (this.menuBar != null && this.menuBar.getParent() == this.layeredPane) {
- this.layeredPane.remove(this.menuBar);
- }
-
- this.menuBar = var1;
- if (this.menuBar != null) {
- this.layeredPane.add(this.menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
- }
-
- }
- }
-